<?php 
namespace Home\Controller;

class SearchController extends BaseController{
    public function index(){
        
        $keyword = I('get.keyword');
        
        if (empty($keyword)){
            $this->error('请填写搜索内容');
        }
        
        // 获取搜索结果
        $blogs = M('blog')->where(array('title'=>array('like','%'.$keyword.'%')))->order('count desc')->select();
        
        $this->assign('blogs',$blogs);
        
        $this->display();
    }
}

?>